package org.dromara.system.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum GetMachineEnum {

    //获取机具状态枚举
    UNPAID(0, "未支付"),
    PENDING_SHIPMENT(1, "待发货"),
    SHIPPED(2, "已发货"),
    SIGNED_FOR(3, "已签收"),
    ;
    @JsonValue
    @EnumValue
    private final Integer code;
    private final String name;


    public static GetMachineEnum findOne(Integer code) {
        return Arrays.stream(GetMachineEnum.values())
            .filter(type -> type.getCode().equals(code)).findAny().orElse(null);
    }
}
